package com.example.actuator.config.annotation;

import com.example.actuator.config.ColorImportBeanDefinitionRegistrar;
import com.example.actuator.config.ColorImportSelector;
import com.example.actuator.config.ColorRegistrarConfiguration;
import org.springframework.context.annotation.Import;

import java.lang.annotation.*;

/**
 * @author void
 * @date 2020/5/24 19:34
 * @desc @Import注解可以用于注入bean,将@Import加到配置类上即可生效,或者如下自定义注解批量注入bean
 * 1.导入普通类
 * 2.导入配置类
 * 3.导入实现ImportSelector的类
 * 4.导入实现ImportBeanDefinitionRegistrar的类
 */
@Documented
@Retention(RetentionPolicy.RUNTIME)
@Target(ElementType.TYPE)
//此处 ColorRegistrarConfiguration 就算不配置也可以注入Yellow对象到容器
@Import({Red.class, ColorRegistrarConfiguration.class, ColorImportSelector.class, ColorImportBeanDefinitionRegistrar.class})
public @interface EnableColor {
}
